package goodbaby.dklt.activity;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.classic.core.activity.BaseActivity;

import goodbaby.dklt.R;
import goodbaby.dklt.fragment.ClassFragment;

/**
 * Created by Li.z on 2016/5/8.
 */
public class ClassDetailActivity extends BaseActivity{
    public static final String KEY_CLASS_ID = "key_class_id";
    private TextView tvTitle;
    private ImageView ivBack;
    private ClassFragment mClassFragment;

    public static void start(Context context,String classId){
        Intent intent = new Intent(context,ClassDetailActivity.class);
        intent.putExtra(KEY_CLASS_ID,classId);
        context.startActivity(intent);
    }

    @Override
    public int getLayoutResId() {
        return R.layout.activity_class_detail;
    }

    @Override
    public void initView() {
        super.initView();
        tvTitle = (TextView) findViewById(R.id.tv_common_title);
        tvTitle.setText("班级");
        ivBack = (ImageView) findViewById(R.id.iv_common_back);
        ivBack.setVisibility(View.VISIBLE);
        ivBack.setOnClickListener(this);

        mClassFragment = new ClassFragment();

        getSupportFragmentManager().beginTransaction().replace(R.id.fl_content,mClassFragment).commit();

        String classId = getIntent().getStringExtra(KEY_CLASS_ID);

        mClassFragment.loadData(classId);
    }

    @Override
    public void viewClick(View v) {
        super.viewClick(v);
        switch (v.getId()) {
            case R.id.iv_common_back:
                finish();
                break;
        }
    }
}
